/*
 * COPYRIGHT. ShenZhen JiMi Technology Co., Ltd. 2017.
 * ALL RIGHTS RESERVED.
 *
 * No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
 * on any form or by any means, electronic, mechanical, photocopying, recording, 
 * or otherwise, without the prior written permission of ShenZhen JiMi Network Technology Co., Ltd.
 *
 * Amendment History:
 * 
 * Date                   By              Description
 * -------------------    -----------     -------------------------------------------
 * 2017年12月22日    LongMin         Create the class
 * http://www.jimilab.com/
*/

package com.futuremap.ws.config;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;

/**
 * @FileName FreemarkConfiguration.java
 * @Description:
 *
 * @Date 2017年12月22日 下午3:49:22
 * @author LongMin
 * @version 1.0
 */
@Configuration
public class FreemarkerConfiguration {

	@Resource
	protected freemarker.template.Configuration configuration;
	@Resource
	protected FreeMarkerViewResolver resolver;
	@Resource
	protected InternalResourceViewResolver springResolver;

	@PostConstruct
	public void setSharedVariable() {
		resolver.setSuffix(".html");
		resolver.setCache(false);
		resolver.setRequestContextAttribute("request");
		resolver.setOrder(0);
		resolver.setExposeRequestAttributes(true);
		resolver.setExposeSessionAttributes(true);
	}
}
